      SUBROUTINE WRDIRSO_S(IUNIT,IREC,IVEC,LENGTH)
C
C WRITES A RECORD TO DIRECT ACCESS UNIT IUNIT.
C
C  INPUT:
C        IUNIT - UNIT NUMBER FOR DIRECT ACCESS FILE.
C        IREC  - NUMBER OF RECORD TO BE WRITTEN.
C        IVEC  - VECTOR TO BE WRITTEN.
C        LENGTH- LENGTH OF VECTOR IN *INTEGER* WORDS.
C
C NOTE: THIS ROUTINE IS A DEPENDENT OF GETLST AND PUTLST.  IF THE
C        SPECIFIED RECORD NUMBER IS <0, IT WILL SIMPLY RETURN RATHER
C        THAN CAUSING AN ERROR EXIT.  ALL PEOPLE WHO USE THIS ROUTINE
C        SHOULD BE AWARE OF THIS.
C
CEND
      IMPLICIT NONE
      integer, intent(in) :: LENGTH, IREC, IUNIT 
      real*4, intent(inout) :: IVEC(LENGTH)
C
      integer irealunit, irealrec, ier
      IF(IREC.LE.0)RETURN
      irealunit=iunit
      irealrec =irec
      WRITE(IrealUNIT,REC=IrealREC,ERR=555,IOSTAT=IER)IVEC
      RETURN
555   WRITE(6,*)'ERROR IN WRDIRSO_S' 
      END
